import RestClient, json, webbrowser

rest = RestClient.RestClient(host='127.0.0.1')

def emulateBlip(id):
    body = {}
    body['eventType'] = "ID_EVENT"
    body['eventID'] = id
    jsonBody = json.dumps(body)
    ret = rest.post("/blip", jsonBody)
    webbrowser.open_new_tab(ret['url'])
    
def addOrder(eventID, name, type, url):
    body = {}
    body['eventType'] = type
    body['eventID'] = eventID
    body['name'] = name
    body['url'] = url
    jsonBody = json.dumps(body)
    rest.put("/order", jsonBody)
    
# Add Watermarks
# addWatermark(31739, 'DStv Online', 'Advert', 'http://www.dstvo.com')
#addWatermark(31740, 'Supersport Rugby', 'Advert', 'http://www.supersport.com/rugby')
#addWatermark(31741, 'Woolworths', 'Advert', 'http://www.woolworths.co.za/')

watermarkIDs = range(31739,31740,1)
for watermarkID in watermarkIDs:
    emulateBlip(watermarkID)